`timescale 1ns/100ps
`include "AlarmTop.v"

module AlarmTop_tb;
reg         t_clk     ;
reg         t_rstn    ;
reg         t_setMode ;
reg         t_setHour ;
reg         t_setMin  ;
reg         t_setAM_PM;

wire [7:0]  t_hour    ;
wire [7:0]  t_min     ;
wire [7:0]  t_sec     ;
wire        t_AM_PM   ;

integer m;
integer h;
initial begin
    t_rstn      <=  1'b0;
    t_clk       <=  1'b0;
    t_setMode   <=  1'b0;
    t_setHour   <=  1'b0;
    t_setMin    <=  1'b0;
    t_setAM_PM  <=  1'b0;
    #2
    t_rstn      <=  1'b1;
    #2
    t_setMode   <=  1'b1;
    #1
    for(h = 0; h < 48; h = h + 1) begin
        t_setHour   <=  ~t_setHour;
        #1;
    end
    for(m = 0; m < 120; m = m + 1) begin
        t_setMin    <=  ~t_setMin;
        #1;
    end
    #2
    t_setAM_PM  <=  ~t_setAM_PM;
    #1
    t_setAM_PM  <=  ~t_setAM_PM;
    #4
    $stop;
end

always #1 t_clk <= ~t_clk;

initial begin
    $dumpfile("wave.vcd");
    $dumpvars(0, AlarmTop_tb);
end

alarmTop AlarmTop_inst(
    .clk        (       t_clk           ),
    .rstn       (       t_rstn          ),

    .setMode    (       t_setMode       ),
    .setHour    (       t_setHour       ),
    .setMin     (       t_setMin        ),
    .setAM_PM   (       t_setAM_PM      ),

    .hour       (       t_hour          ),
    .min        (       t_min           ),
    .sec        (       t_sec           ),       // always :00
    .AM_PM      (       t_AM_PM         )
);

endmodule